﻿using System;
using System.Data;
using Entities;
using DataAccess;
using System.Collections.Generic;


namespace Business
{
    public class TicketBUS
    {
        public static Ticket Get_Ticket_By_ID(int tkID)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Get_Ticket_By_ID(tkID);
        }

        public static List<Ticket> GetAll_Ticket()
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.GetAll_Ticket();
        }

        public static List<Ticket> GetList_Ticket(string whereSql, string orderBy)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            if (string.IsNullOrEmpty(orderBy)) orderBy = "";
            if (string.IsNullOrEmpty(whereSql)) whereSql = "";
            return ticket_DAL.GetList_Ticket(whereSql, orderBy);
        }

        public static DataTable Search_TicketInfo(string CustName, DateTime date, int status)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Search_TicketInfo(CustName, date, status);
        }


        public static DataTable Search_TicketInfoByID(int ticketID)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.SearchTicketInfoByID(ticketID);
        }

        public static DataTable Search_TicketByStatus(int status)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Search_TicketByStatus(status);
        }

        public static DataTable GetList_TicketInfo()
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.GetList_TicketInfo();
        }

        public static DataTable PrintTicket(int TicketID)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.PrintTicket(TicketID);
        }
       
        public List<Ticket> Get_TicketAsPaging(string sWhere, string sOrderBy, int pageIndex, int pageSize)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            if (string.IsNullOrEmpty(sWhere)) sWhere = "";
            if (string.IsNullOrEmpty(sOrderBy)) sOrderBy = "";
            return ticket_DAL.Get_TicketAsPaging(sWhere, sOrderBy, pageIndex, pageSize);
        }

        public static bool Insert_Ticket(Ticket temp)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Insert_Ticket(temp);
        }

        public static bool Update_Ticket(Ticket temp)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Update_Ticket(temp);
        }

        public static bool Update_Ticket_Status(Ticket temp)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Update_Ticket_Status(temp);
        }

        public static bool Delete_Ticket(int id)
        {
            TicketDAL ticket_DAL = new TicketDAL();
            return ticket_DAL.Delete_Ticket(id);
        }
    }
}
